package servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import controller.EmpController;
import entity.T_account;


@WebServlet("/EmpShowServlet")
public class EmpShowServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    public EmpShowServlet() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		EmpController controller=new EmpController();
		List<T_account> t_accounts = controller.allInfoList();	
		HttpSession session = request.getSession();
		session.setAttribute("empsList", t_accounts);
		request.getRequestDispatcher("main.jsp").forward(request, response);
	}

}
